




/*
     FILE ARCHIVED ON 3:03:41 Oct 16, 2011 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 18:07:36 Jan 17, 2014.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
/**************************************************************
function:	Log out
***************************************************************/
function doLogOut() {
    //if(confirm('<bean:message key="nser.index.logout.confirm.message"/>'))
   // if(confirm(document.getElementById('logOut').value))
   // {
	//document.forms["rightForm"].action = path + "/OV/OVLogoutAction.do";
	//document.forms["rightForm"].submit();
	top.document.location.href=path + "/OV/OVLogoutAction.do";
   // }
}
/**
 *	CdrQuery.jsp
 *   cheny
 **/
function doCdrChange() {
	var d = document.getElementById("date_1");
	if (d.checked) {
		document.getElementById("d_1").style.display = "";
		document.getElementById("d_2").style.display = "";
		document.getElementById("d_3").style.display = "none";
	} else {
		document.getElementById("d_1").style.display = "none";
		document.getElementById("d_2").style.display = "none";
		document.getElementById("d_3").style.display = "";
	}
}
function doCdrSubmit() {
	obj = document.getElementById("cdrQryForm");
	var type_con = "";
	var type_int = "";
	var type_sms = "";
	var type_mms = "";
	var server_type = "";
	var date_m;
	if (document.getElementById("date_1").checked) {
		date_m = "date";
	} else {
		date_m = "month";
	}
	
	document.getElementById("startDate").value = $("input[name='date-1']")[0].value;
	document.getElementById("endDate").value = $("input[name='date-2']")[0].value;
	if (document.getElementById("serverType"))
	{
			server_type = document.getElementById("serverType").value ;
	}
	document.forms["cdrQryForm"].action= path+"/BusinessInfoQuery/STGetCDRhistoryAction.do?method=getCDRhis&type_con="+type_con+"&type_int="+type_int+"&type_sms="+type_sms+"&type_mms="+type_mms+"&date="+date_m+"&serverType="+server_type;
	document.forms["cdrQryForm"].method = "post";
	//var newWinName = window.open("","login","scrollbars=yes,toolbar=no, menubar=no, location=no, status=no");
	//newWinName.name = 'newWin';
	//document.forms["cdrQryForm"].target='newWin';
	document.forms["cdrQryForm"].submit();
}
/**
 *	CdrResult.jsp
 *
 **/
function doCdrBack()
	{
		obj = document.getElementById("cdrQryForm");
		obj.action = path+"/BusinessInfoQuery/STGetCDRhistoryAction.do?method=init";
		obj.submit();
	}
	
/**
*TransHisInfoquery.jsp
**/
function doTransHisSubmit() {
	document.getElementById("startDate").value =  $("input[name='date-1']")[0].value;
	document.getElementById("endDate").value =  $("input[name='date-2']")[0].value;
}
/**
*paymentHisInfoQuery.jsp
*/
function doPaymentHisSubmit() {
	document.getElementById("startDate").value =  $("input[name='date-1']")[0].value;
	document.getElementById("endDate").value =  $("input[name='date-2']")[0].value;
	document.forms["paymentHisForm"].action = path + "/payment/queryPaymentHistory.do?method=queryResult&menuid=M20014";
	document.forms["paymentHisForm"].method = "post";
	document.forms["paymentHisForm"].submit();
}
/**
 * function: Login check and submit
 * purpose:loginEC.jsp
 */
function doLogin() 
{
	var loginType = document.getElementById("loginType");
	var ecid = document.getElementById("ecid");
	var password = document.getElementById("passwordIn");
	document.getElementById("password").value = password.value;
	password.value = "";
	document.forms[0].submit();
}

function key_loginEnter(event)
{
	//var keycode = event.keyCode;
	if( event.keyCode == '13')
	{
		doLogin();
	}
}


function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else {
		if (obj.y) {
			curtop += obj.y;
		}
	}
	return curtop;
}
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} else {
		if (obj.x) {
			curleft += obj.x;
		}
	}
	return curleft;
}
function validateDate() {
	var tempStartDate = document.getElementById("date-1-dd").value;
	var tempEndDate = document.getElementById("date-2-dd").value;
	if (tempStartDate == null || tempStartDate == "") {
		alert(document.getElementById("startDateempty").value);
		document.getElementById("date-1-dd").focus();
		return false;
	}
	if (tempEndDate == null || tempEndDate == "") {
		alert(document.getElementById("endDateempty").value);
		document.getElementById("date-2-dd").focus();
		return false;
	}
	return true;
}
function trim(str) {
	for (i = 0; i < str.length && str.charAt(i) == " "; i++) {
	}
	for (j = str.length; j > 0 && str.charAt(j - 1) == " "; j--) {
	}
	if (i > j) {
		return "";
	}
	return str.substring(i, j);
}
function backToLastPage() {
	formObj = document.forms[0];
	formObj.actionDesc.value = formObj.lastAction.value;
	formObj.submit();
}


/////////
///DIV实现popup
/////////
///显示popup

function showPopup(title, content, control) {

    //var top = calculateOffset(objControl, "offsetTop")-height-1;
    //var left = calculateOffset(objControl, "offsetLeft");//
	var r = getAbsolutePos(control);
	var top = r.y + 12;
	var left = r.x + 12;

//  var widthGap = objControl.parentNode.offsetWidth - objControl.parentNode.clientWidth;
//  var heightGap = objControl.parentNode.offsetHeight - objControl.parentNode.clientHeight;
	var objDiv = createDiv(top, left, width);
	objDiv.innerHTML = "<h3>" + title + "</h3><p>" + content + "</p>";
	document.getElementById("content").appendChild(objDiv);
}
//计算字段的相对于html的偏移量(offsetTop和offsetLeft)
// function calculateOffset(field, attr)
// {
//  var offset = 0;
//  while (field)
//  {
//      offset += field[attr];
//      //alert(field.nodeName);
//      field = field.offsetParent;
//        [Page]
//
//  }
//  return offset;
// }
//创建一个DIV对象
function createDiv(top, left, width) {

    //var str = "<div id='divPopup'></div>";
	var objDiv = document.createElement("div");
	objDiv.id = "divPopup";

    //设置DIV的位置、大小和边框
    //objDiv.style.border = "#E6F2FA 2px solid";
    //objDiv.style.height = height;
	objDiv.style.width = width + "px";
	objDiv.style.top = top + "px";
	objDiv.style.left = left + "px";
    
    //alert(div1.outerHTML);
	return objDiv;
}
//移除DIV
function removeDiv() {
    //document.forms[0].firstChild.removeChild(document.getElementById('divPopup'));
	var divPoppup = document.getElementById("divPopup");
	if (divPoppup) {
		divPoppup.parentNode.removeChild(divPoppup);
	}
    //document.getElementById('divPopup').parentNode.removeChild(document.getElementById('divPopup'));
}

function getAbsolutePos(el) {
	var SL = 0, ST = 0;
	var is_div = /^div$/i.test(el.tagName);
	if (is_div && el.scrollLeft) {
		SL = el.scrollLeft;
    //alert(SL);
	}
	if (is_div && el.scrollTop) {
		ST = el.scrollTop;
	}
	var r = {x:el.offsetLeft - SL, y:el.offsetTop - ST};
	if (el.offsetParent) {
		var tmp = this.getAbsolutePos(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}
	return r;
}

// chenwh change language
function showchangelanguage() {
	var obj_lang_id = document.getElementById("language_change_to");
	if (obj_lang_id != null) {
		document.location.href = path + "/login/loginToECAction.do?method=changeLanguage&locale_type=" + obj_lang_id.value;
	}
}
// chenwh open bill page
function showBillpage() {
	window.open("", "billpage");
	document.billqueryform.target = "billpage";
	document.billqueryform.submit();
}

// chenwh goto register
function gotoRegisterPage() {
	location.href = path + "/login/RegisterAction.do?method=init";
}
function nextRegisterFromUser() {
	//document.getElementById("birthday").value= $("input[name='date-1']")[0].value;
	document.RegisterForm.action = path + "/login/RegisterAction.do?method=nextToProduct";
	document.RegisterForm.submit();
}
function cancelRegisterCancel() {
	location.href = path;
}


//lijuan add 2009-8-18
//prepaid subscribers do activation by himself
function doPrepaidActive() {
	var obj = document.getElementById("PrepaidActivateForm");
	obj.action = path + "/login/STPrepaidActiveAction.do?method=prepaidActive";
	obj.method = "post";
	obj.submit();
}

// reset password
function gotoresetPassword() {
	location.href = path + "/STResetPasswordAction.do?method=init";
}
function gotoLogin() {
	location.href = path + "/login/loginToECAction.do?method=init";
}

//forgot service password
function gotoForgotPassword() {
	location.href = path + "/forgotServicePassword/forgotServicePassword.do?method=init";
}


function doResetPassword() {
	document.forms["ForgotSerivicePasswordForm"].action = path + "/forgotServicePassword/forgotServicePassword.do?method=dataCommit";
	document.forms["ForgotSerivicePasswordForm"].method = "post";
	document.forms["ForgotSerivicePasswordForm"].submit();
}

//重置密码中，语音用户的下一步获取随机数事件
function doNextPassword() {
	document.forms["ForgotSerivicePasswordForm"].action = path + "/forgotServicePassword/forgotServicePassword.do?method=mobileNext";
	document.forms["ForgotSerivicePasswordForm"].method = "post";
	document.forms["ForgotSerivicePasswordForm"].submit();
}
//返回登录页面
function doCancelPassword() {
	location.href = path + "/login/loginToECAction.do?method=init";
}
function doMobileCancelPassword() {
	location.href = path + "/login/loginToECAction.do?method=init";
}

//重置密码中，语音用户重置密码提交事件
function doResetPasswordByMobile() {
	document.forms["ForgotSerivicePasswordForm"].action = path + "/forgotServicePassword/forgotServicePassword.do?method=mobileCommit";
	document.forms["ForgotSerivicePasswordForm"].method = "post";
	document.forms["ForgotSerivicePasswordForm"].submit();
}
function doChangeTetelType() {
	var tetelType = document.getElementById("tetelType").value;
	var dataTeteltype = $('#dataTeleType')[0].value;
	if (dataTeteltype.indexOf(tetelType) != -1) {
		document.getElementById("resetPwdFName").style.display = "";
		document.getElementById("resetPwdLName").style.display = "";
		document.getElementById("resetNewPwd").style.display = "";
		document.getElementById("resetConfirmNewPwd").style.display = "";
		document.getElementById("dataCommit").style.display = "";
		document.getElementById("resetRandPwdNext").style.display = "none";
		document.getElementById("mdn").style.display = "none";
		document.getElementById("uri").style.display = "";
		document.getElementById("checkNumImg").style.display = "";
		document.getElementById("pswSecurityQuestion").style.display = "";
		document.getElementById("pswSecurityAnswer").style.display = "";
	} else {
		document.getElementById("resetPwdFName").style.display = "none";
		document.getElementById("resetPwdLName").style.display = "none";
		document.getElementById("resetNewPwd").style.display = "none";
		document.getElementById("resetConfirmNewPwd").style.display = "none";
		document.getElementById("dataCommit").style.display = "none";
		document.getElementById("resetRandPwdNext").style.display = "";
		document.getElementById("uri").style.display = "none";
		document.getElementById("mdn").style.display = "";
		document.getElementById("checkNumImg").style.display = "none";
		document.getElementById("pswSecurityQuestion").style.display = "none";
		document.getElementById("pswSecurityAnswer").style.display = "none";
	}
	if(tetelType=="41"){
		document.getElementById("uri").style.display = "none";
		document.getElementById("mdn").style.display = "";
	}
	//lrf  2010-07-05 start 
	 setFooterHeight('y');
	//lrf  2010-07-05 end 
}


function doSuspend() {
	var obj = document.getElementById("STChangeSuspendReconnectActionForm");
	obj.action = path + "/OV/change/OVChangeSuspendOrReconnectSubEAction.do?method=doSuspend";
	obj.method = "post";
	document.getElementById("buttonDoSuspend").disabled = true;
	obj.submit();
}


function doReconnect() {
	var obj = document.getElementById("STChangeSuspendReconnectActionForm");
	obj.action = path + "/OV/change/OVChangeSuspendOrReconnectSubEAction.do?method=doReconnect";
	obj.method = "post";
	document.getElementById("buttonDoReconnect").disabled = true;
	obj.submit();
}


function password_change_type() {
	var max = document.getElementById("passwordLength").value;
	if (document.getElementById("change_type_id3").checked == true) {
		max = document.getElementById("passwordLength_AAA").value;
	}
	var oldpassword = document.getElementById("oldpassword");
	var newpassword = document.getElementById("changeNewPassword");
	var confirmnewpassword = document.getElementById("confirmnewpassword");
	oldpassword.maxLength = max;
	newpassword.maxLength = max;
	confirmnewpassword.maxLength = max;
	if (oldpassword.value.length > max) {
		oldpassword.value = "";
	}
	if (newpassword.value.length > max) {
		newpassword.value = "";
	}
	if (confirmnewpassword.value.length > max) {
		confirmnewpassword.value = "";
	}
}
function pwdDisplay() {
	document.getElementById("pwdDisplay").style.display = "none";
	doChangeTetelType();
	document.getElementById("pwdDisplay").style.display = "";
}


function changeImg(src)
{
	////modi by lrf lkf22290
	var s =Math.random(); 
	 $("#checkImg").attr("src",path + "/" + src + "?radom=" + s);
     $("#checkImg").css("display","");
//    document.getElementById("checkImg").src = path + "/" + src + "?radom=" + s;
//    document.getElementById("checkImg").style.display = "";
}
// modify and add by pkf18720 CC&BM R002C12L01100  2010-03-01  begin
function setToPage(action, pageno, pagesize)
{
	var formObj = $("form[action*='"+action+"']");
	formObj[0].action = path+action+"&pageno="+pageno+"&pagesize="+pagesize;
    formObj[0].submit();
}
function goToPage(action,pagesize)
{
	var formObj = $("form[action*='"+action+"']");
   	var topageno=formObj[0].gotopage.value;
	setToPage(action, topageno, pagesize);
}
function onlyNum(event)
{	
	if(event)
	{
		if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)||event.keyCode==8))
		{
			if ( event && event.preventDefault )           
				event.preventDefault();       
			else          
				event.returnValue = false;   
		}
	}
}
function checkGoToPage(action,obj,totalpage)
{
	var formObj = $("form[action*='"+action+"']");
	var topageButton=formObj[0].gotoButton;
 	var values=obj.value;
 if(values.length==0)
   {
    topageButton.disabled=true;
    return;
   }
   if(isNaN(values))
   {
   topageButton.disabled=true;
     return;
   }
   if(parseInt(values)<=0 || parseInt(values)>totalpage)
   {
   topageButton.disabled=true;
     return;
   }
   topageButton.disabled=false;
}
// modify and add by pkf18720 CC&BM R002C12L01100 2010-03-01  end
function doRegisterFinish()
{
	document.RegisterForm.action = path + "/login/RegisterAction.do?method=finish";
	document.RegisterForm.method = 'post';
    document.RegisterForm.submit() ;
}
//add by lkf22290 start
function doaddPswSecurity(event){
	if(event.keyCode==13){
		addPswSecurity();
	}
}
//add by lkf22290 end
function addPswSecurity()
{
	//document.CheckPswSecurityForm.action = path + "/login/checkpswsecurity.do?method=add" ;
	//document.CheckPswSecurityForm.method = 'post';
   // document.CheckPswSecurityForm.submit() ;
    // modi by lrf lkf22290 strat
    document.forms["CheckPswSecurityForm"].action = path + "/login/checkpswsecurity.do?method=add" ;
    document.forms["CheckPswSecurityForm"].method = 'post';
    document.forms["CheckPswSecurityForm"].submit() ;
    // modi by lrf lkf22290 end

}
function showDomain(obj)
{
	var flag=false;
	if(obj=='uri'){
		flag=true;
	}
	else{
		flag=false;
	}
	if(flag == true)
	{
		document.getElementById('uridomain').style.display = "";
		document.getElementById('mdn').style.display = "none";
		document.getElementById('uri').style.display = "";
	}
	else
	{
		document.getElementById('uridomain').style.display = "none";
		document.getElementById('mdn').style.display = "";
		document.getElementById('uri').style.display = "none";
	}
}
//add by skf21685 2009-12-26  R002C12L00900 Begin
function checkOther()
{
   var box = document.getElementById('otherbox');
   if( box.checked )
   {
      document.getElementById('displayRowReacherNumber').style.display ="";
   }
   else
   {
      document.getElementById('displayRowReacherNumber').style.display ="none";
   } 
}
function radiocheck(obj)
{
  document.getElementById('displayRowReacherNumber').style.display = "none";
  document.getElementById('Imdn').value = obj.value;
  document.getElementById('otherbox').checked = false;
}
//query the input msisdn
function selectAccount()
{
  document.getElementById('inputMsisdn').value = document.getElementById('Imdn').value;
  document.VoucherCardActionForm.action = path + "/VoucherCardAction.do?method=init";
  document.VoucherCardActionForm.method = "post";
  document.VoucherCardActionForm.submit();
}
function selectValue()
{
 document.getElementById('Imdn').select();
}
function likePage(index)
{
   document.getElementById("suIds").value =  document.getElementById("param"+index).value;
   document.getElementById("actalogId").value =  document.getElementById("catalogid"+index).value;
   document.getElementById("showExtra").value =  document.getElementById("showextra"+index).value;
   document.STMyAccountInfoActionForm.submit();
}

//add by skf21685 2009-12-26  R002C12L00900 end

// add by kf18031 2010-01-12 CC&BM R002C12L00900 AAAPassword start
function checkAAAPasswordSpace(obj)
{
    obj.value = obj.value.replace(/\s/g, "");
    
    if (window.event.keyCode==32)
    {

        window.event.keyCode = 0x0;

    }

}

function checkChangeAAAPasswordSpace(obj)
{
	    checkAAAPasswordSpace(obj);
    
}

function checkedChangeAAAPasswordSpace()
{
	$('#oldpassword')[0].value = "";
    $('#changeNewPassword')[0].value = "";
	$('#confirmnewpassword')[0].value = "";
}
// add by kf18031 2010-01-12 CC&BM R002C12L00900 AAAPassword end

//add by lkf21684
function toExtraSubmit(hid)
{
	var hid = $("#"+hid)[0].value;
	var params = hid.split("-");
	
	$("#subId")[0].value = params[0];
	$("#rpId")[0].value = params[1];
	$("#spId")[0].value = params[2];
	$("#preFlag")[0].value = params[3];
	$("#telType")[0].value = params[4];
	$("#productIds")[0].value = params[5];
	$("#serIds")[0].value = params[6];
	$("#paramIds")[0].value = params[7];
	$("#form_change")[0].action = path + "/BasicInfoQuery/STMyAccountInfoAction.do?method=changeProduct";
	$("#form_change")[0].submit();
	
}
//added by ykf21714
function changeMust()
{
	if(document.CreateSubscribersForm.customerType.value == 0)
	{

		$('#organizationName').css("display","none");
		$('#titleStar').css("display","none");
		$("#placeOfBirth").css("display","");
		
	}
	if(document.CreateSubscribersForm.customerType.value == 1)
	{
		
		$('#organizationName').css("display","");
		$('#titleStar').css("display","");
		$("#placeOfBirth").css("display","none");
	}
}

function choice()
{
	$("input[name='cpeValue']").attr("readonly","true");
	$("#getResourceBtn").removeAttr("disabled");
}
function manual()
{
	$("input[name='cpeValue']").removeAttr("readonly");
	$("#getResourceBtn").attr("disabled","true");
}
function getResource(resType)
{
	var url = path+"/createSubscribers/CreateSubscribersAction.do?method=getResource&resType="+resType;
	var returnValue = window.showModalDialog(url,"","scroll:auto;;status:0;help:0;resizable:0;dialogWidth:530px;dialogHeight:750px");

	if(returnValue)
	{
		//
		var array = returnValue.split(",");
		if(null != $("input[name='cpeValue']"))
		{
			$("input[name='cpeValue']").val(array[0]);
			$("input[name='cpeResCode']").val(array[1]);	
			$("input[name='resModelId']").val(array[2]);
			$("input[name='dealerId']").val(array[3]);
			$("input[name='inputCpeType']").val("1");		
		}
		if(null != $("input[name='newVOIPNumber']"))
		{
			$("input[name='newVOIPNumber']").val(array[0]);
		}
	}

}
function queryRes()
{
	var resType = $("input[name='resType']").val();
	document.QueryResourceActionForm.action = path+"/QueryResourceAction.do?method=toQueryRes&resType="+resType;
	document.QueryResourceActionForm.target="search";
	document.QueryResourceActionForm.method = "post";
    document.QueryResourceActionForm.submit();

}
function submitRes()
{
	var selectRadioValue = "";
    if (document.forms(0).resRadio!=null)
    {
        if (document.forms(0).resRadio.length == null)
        {
            if (document.forms(0).resRadio.checked)
            {
                selectRadioValue = document.forms(0).resRadio.value;
            }
        }
        else for (var i=0; i<document.forms(0).resRadio.length; i++)
        {
            if (document.forms(0).resRadio[i].checked)
            {
                selectRadioValue = document.forms(0).resRadio[i].value;
                break;            
            }
        }
    }
    if (selectRadioValue=="")
    {
        var resErr = $("input[name='resErr']").val();
        alert(resErr);
        return false;
    }   	
    window.returnValue = selectRadioValue;
    window.close();
    
}
function downLoadFile(obj,fileName)
{
	var filePath = obj.name
	document.forms[0].action =  path + "/OV/query/OVQrySubscriberInfoSAction.do?method=downLoadFile&fileName="+fileName+"&filePath="+filePath+"";
	document.forms[0].method = "post";
	document.forms[0].submit();
}
function checkCPE()
{
	var cpeValue = $("input[name='cpeValue']").val();
	var cpeError = $("input[name='cpeError']").val();
	if(null == cpeValue || cpeValue == "" || cpeValue.length != 12)
	{
		alert(cpeError);
		return false;
	}
	else
	{
		return true;
	}
}

//added by ykf21714

//add by kf18031 CC&BM R002C12L01000 begin
function gotoCreateSubscribers()
{
	location.href = path + "/createSubscribers/CreateSubscribersAction.do?method=init";
}
function nextCreateSubForRP()
{
	document.CreateSubscribersForm.action = path + "/createSubscribers/CreateSubscribersAction.do?method=nextProdRP";
	document.CreateSubscribersForm.submit();
}

function gotoNext()
{
	if ("create" == $('#methodAction')[0].value)
	{
		document.spForm.action = path + "/createSubscribers/CreateSubscribersAction.do?method=nextProdParam";
		document.spForm.submit();
	}
	else
	{
		document.spForm.action = path + "/modifyProduct/ModifyProductAction.do?method=changeParam";
		document.spForm.submit();
	}
	
}
function gotoResource(obj)
{

	//var inputId = $(obj).prev()[0].id;
	var resType = $(obj).parent().prev().children()[0].id;
	var url = path+"/createSubscribers/CreateSubscribersAction.do?method=getResource&resType="+resType;
	var returnValue = window.showModalDialog(url,"","scroll:auto;;status:0;help:0;resizable:0;dialogWidth:530px;dialogHeight:750px");
	if(returnValue)
	{
		var array = returnValue.split(",");
		$(obj).parent().prev().children().val(array[1]);//array[0]
		$("input[name='resource']").val($("input[name='resource']").val()+"/"+array[1]+","+resType);//array[1]为返回的资源CODE
	}
}

function gotoFeeResult()
{
	if ("create" == $('#methodAction')[0].value)
	{
		document.paramForm.action = path + "/createSubscribers/CreateSubscribersAction.do?method=paramNext";
	}
	else
	{
		document.paramForm.action = path + "/modifyProduct/ModifyProductAction.do?method=paramNext";
	}
	
	document.paramForm.submit();
}
//add by kf18031 CC&BM R002C12L01000 end


// add by pkf18720 CC&BM R002C12L01000  2010-1-21  begin
function FeeInfoLocationTo(actionpath)
{
location.href = path + actionpath;
}
// add by pkf18720 CC&BM R002C12L01000  2010-1-21  end
function toDate()
{
	//修改DOB出错问题 兼容多浏览器 modi by lrf kf22290
 document.getElementById("birthday").value=document.getElementsByName("date_birthday")[0].value;

}

function showMsg()
{

  if(document.getElementById("ConCustId").value == document.getElementById("simp.custID").value)
  {
     alert(document.getElementById("showmsg").value);
     return false;
  }
  else
  {
    return true;
  }
}
//add by pkf18720 CC&BM R002C12L01100  2010-03-01  begin
function vpnMemberSelectALL()
{
var obj=document.forms("VpnSubMemberQueryActionForm").selectMember;
var cl=document.forms("VpnSubMemberQueryActionForm").memberSelectAll;
if(cl.checked == true)
{
if(obj.length != null)
{
    for(var i=0;i<obj.length;i++)
    {
    obj[i].checked=true;
    }
}
else
{
obj.checked=true;
}

}
else
{
if(obj.length != null)
{
    for(var i=0;i<obj.length;i++)
    {
    obj[i].checked=false;
    }
}
else
{
obj.checked=false;
}
}
}

function vpnSelectMemberSubmit(funcName,nums)
{
if(null ==nums || ""==nums)
{
 nums=1;
}
var obj=document.getElementById("VpnSubMemberQueryActionForm").selectMember;
var allselectobj=document.getElementById("VpnSubMemberQueryActionForm").allSelectMemberString.value;
var pageallobj=document.getElementById("VpnSubMemberQueryActionForm").memberSelectString.value;
var allObj=allselectobj.split(";");
var pageobj=pageallobj.split(";");
var selectStr="";
if(obj.length != null)
{
for(var i=0;i<obj.length;i++)
{
   if(true==obj[i].checked)
   {
   selectStr=selectStr+obj[i].value+";";
   }
}
if(selectStr.length>0)
{
 selectStr=selectStr.substr(0,selectStr.length-1);
}
}
else
{
if(obj.checked)
{
selectStr=obj.value;
}
}
var selectobj=selectStr.split(";");
var nopageselect="";
var allStr="";
var icount=0;
var jcount=0;
var tcount=0;
for(var i=0;i<pageobj.length;i++)
{
  icount=0;
   for(var j=0;j<selectobj.length;j++)
   {
     if(pageobj[i]==selectobj[j])
     {
      icount++;
     }
   }
   if(icount==0)
   {
   nopageselect=nopageselect+pageobj[i]+";";
   }
}
  
  if(nopageselect.length>0)
  {
  nopageselect=nopageselect.substr(0,nopageselect.length-1);
  var nopageobj=nopageselect.split(";");
    for(var i=0;i<allObj.length;i++)
    {
    jcount=0;
     for(var j=0;j<nopageobj.length;j++)
     {
     if(allObj[i]==nopageobj[j])
     {
     jcount++;
     }
     }
     if(jcount==0 && ""!=allObj[i])
     {
     allStr=allStr+allObj[i]+";";
     }
    }
  }
  else
  {
  for(var i=0;i<allObj.length;i++)
  {
    if(""!=allObj[i])
     {
     allStr=allStr+allObj[i]+";";
     }
   }
  }
  
  if(selectobj.length>0)
  {
  for(var i=0;i<selectobj.length;i++)
    {
    tcount=0;
     for(var j=0;j<allObj.length;j++)
     {
     if(allObj[j]==selectobj[i])
     {
     tcount++;
     }
     }
     if(tcount==0 && ""!=selectobj[i])
     {
     allStr=allStr+selectobj[i]+";";
     }
    }
  }
  if(allStr.length>0)
  {
  allStr=allStr.substr(0,allStr.length-1);
  allStr=allStr.split(";");
  var adminCount=0;
  var memberCount=0;
  var adminStr="";
  var admin="";
  for(var i=0;i<allStr.length;i++)
  {  
  admin=allStr[i].split(":");
  if(admin[4]==1)
  {
  adminCount++;
  adminStr=adminStr+admin[1]+"["+admin[2]+"] \r";
  }
  else
  {
  memberCount++;
  }
  }
  if(funcName=='VpnDeleteMember')
  {
    if(adminCount>0)
    {
    document.getElementById("batchPaymentRelationShipLimite").style.display='none';
    document.getElementById("selectError").style.display='none';
    document.getElementById("deleteAdminCount").style.display='none';
    document.getElementById("adminStr").innerHTML=adminStr;
    document.getElementById("deleteAdminLimite").style.display='';
    return;
    }
    if(allStr.length>nums)
    {
    document.getElementById("batchPaymentRelationShipLimite").style.display='none';
    document.getElementById("deleteAdminLimite").style.display='none';
    document.getElementById("selectError").style.display='none';
    document.getElementById("deleteAdminCount").style.display='';
    document.getElementById("deleteAdminCountLimite").innerHTML=nums;
    return;
    }
  }
  else if(funcName=='VpnModifyPaymentRelation')
  {
    if(allStr.length>nums)
    {
    document.getElementById("deleteAdminLimite").style.display='none';
    document.getElementById("selectError").style.display='none';
    document.getElementById("deleteAdminCount").style.display='none';
    document.getElementById("batchPaymentRelationShipLimite").style.display='';
    document.getElementById("batchPaymentRelationShipCount").innerHTML=nums;
    return;
    }
  }
  }
  else
  {
  document.getElementById("batchPaymentRelationShipLimite").style.display='none';
   document.getElementById("deleteAdminLimite").style.display='none';
   document.getElementById("deleteAdminCount").style.display='none';
   document.getElementById("selectError").style.display='';
   return;
  }
  
if(funcName=='VpnDeleteMember')
{
  if(!confirm(document.forms("VpnSubMemberQueryActionForm").deleteMessage.value))
  {
  return;
  }
}
document.getElementById("VpnSubMemberQueryActionForm").action=path + '/vpn/vpnGroupMemberQuery.do?method=submitProcess';
document.forms[0].method = "post";
document.forms[0].submit();
}
//add by pkf18720 CC&BM R002C12L01100  2010-03-01  end

//add by kf18031 2010-3-1 CC&BM R002C12L01100 Query Reserve code start
function queryReserveCodeLink()
{
	location.href = path + "/reserveCode/queryReserveCodeAction.do?method=init";
}

function queryReserveCodeConfirm()
{
	var idCardNumber = $('#idCardNumber')[0].value;
	var birthday = $("input[name='reserveDateofbirth']").val();
	
	var param = "idCardNumber" + "=" + idCardNumber + "&" + "reserveDateofbirth" + "=" + birthday;
	
	var url = path+"/reserveCode/queryReserveCodeAction.do?method=checkDataInfo";
	
	getParams(url,param,function(msg)
    {
        var flag = displayError(msg,name);
        
        if(flag)
        {
           $('#reserveCodeForm')[0].submit();
        }
        
    }
    );
	
}

//check id card number
function checkIdNumber()
{
	var url = path+"/reserveCode/queryReserveCodeAction.do?method=checkDataInfo";
	ajaxsubMit($('#idCardNumber')[0],url,function(flag){});
}

//check birthday
function bindDateBlur()
{
	var evt_old_onblur =  $("input[name='reserveDateofbirth']")[0].onblur;
	
   $("input[name='reserveDateofbirth']").bind("blur",function()
   {
   	  
   	  
   	  if($("form[name='reserveCodeForm']")[0].action == "/nser/reserveCode.do?method=initSlectNumber")
  	  {
  		   checkcustomerInput($("input[name='reserveDateofbirth']")[0]);
  	  }
  	  else
  	  {
  	  		var url = path+"/reserveCode/queryReserveCodeAction.do?method=checkDataInfo";
   	  		ajaxsubMit($("input[name='reserveDateofbirth']")[0],url,function(flag){});
  	  }
  	  
   });
}

function selectPrintReserveCode()
{
	$('#selectReserveCodeForm')[0].submit();
}

function printReturnReceipt(flag)
{
  	if(flag != null && flag == "yes")
    {
	     reservesubmit();
	     document.reserveCodeForm.action = path + "/reserveCode.do?method=print";
    }
    else
    {
    	document.reserveCodeForm.action = path+"/reserveCode/queryReserveCodeAction.do?method=print";
    }
    
    window.open ("", 'newwindow', 'height=620, width=550, top=350, left=500, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=n o, status=no');
	document.reserveCodeForm.target = "newwindow";
	document.reserveCodeForm.submit();
}

function selectReserveCodeUndisAbled()
{
    $('#selectReserveCode').removeAttr("disabled");
}
//add by kf18031 2010-3-1 CC&BM R002C12L01100 Query Reserve code end

//add ckf11822 CC&BM R002C12L01100 Query login log start
function doLogQuey()
{

    $("input[name='startTime']")[0].value = $("input[name='date-1']")[0].value;
    $("input[name='endTime']")[0].value = $("input[name='date-2']")[0].value;
    
    $("form")[0].submit();
}

function gotoPageReturn(url)
{
	$("form")[0].action = path + url; 
	$("form")[0].submit();
}
function vpnQueryMember()
{
document.forms[0].action=path + '/vpn/vpnGroupMemberQuery.do?method=queryMember&reset=true';
document.forms[0].method = "post";
document.forms[0].submit();
}
//add ckf11822 CC&BM R002C12L01100 Query login log end

//add by skf21685 2010-2-27 R002C12L01100 begin
function reserveCodeIndex()
{
	location.href = path + "/reserveCode.do?method=init";

}
function viewFullText(fullText)
{
	if($('#viewText')[0].style.height == '250px')
	{
		$('#viewText').css("height","28px"); 
		$('#viewText').css("overflow-y","hidden");
		return;
	}
		
  	$('#viewText').css("white-space","normal");
  	$('#viewText').css("height","250px");  
  	$('#viewText').css("overflow-y","auto");
  	
	   if($.browser.msie){
	    	$("#content").css("height","auto");
	   }else{
	     var h=$("#content").css("height");
	     h = h.replace('px', '');
	     h = parseInt(h) + 100;
	     h = h + 'px';
	     if(h>=("500px")){
	   		$("#content").css("height",h);
	     }
	     else{
	     	$("#content").css("height","500px");
	     }
	   }
}
function agreedTerm()
{
  if($('#agreed')[0].checked)
  {
    $('#agreedNext').removeAttr("disabled");
  }
  else
  {
    $('#agreedNext').attr("disabled","disabled");
  }
}

function agreedNext()
{
  $("form[name='reserveCodeForm']")[0].action = path + '/queryCustomerReservationInfo.do?method=initCustomerIdentity';
  $("form[name='reserveCodeForm']")[0].submit();
}

function submitCheck(name)
{
	
   var idNumberName = "idCardNumber";
   var idCardTypeName = "idCardType";
   var firstName = "firstName";
   var lastName = "lastName";
   var midName = "midName";
   var locationofbirth = "locationOfbirth";
   var gender = "gender";
   var contactFixedNumber = "contactFixedNumber";
   var contactMobileNumber = "contractMobileNumber";
   var email = "email";
   var address = "address";
   var verifyingCode = "verifyingCode";
   var dateofbirth = "reserveDateofbirth";
   
   var contactFixedNumberValue = $("input[name='"+contactFixedNumber+"']").val();
   var contactMobileNumberValue = $("input[name='"+contactMobileNumber+"']").val();
   var emailValue = $("input[name='"+email+"']").val();
   var addressValue = $("select[name='"+address+"']").val();
   var verifyingCodeValue = $("input[name='"+verifyingCode+"']").val();
   var idNumberValue = $("input[name='"+idNumberName+"']").val();
   var idCardTypeValue = $("[name='"+idCardTypeName+"']").val();
   var firstNameValue =  $("input[name='"+firstName+"']").val();
   var lastNameValue =  $("input[name='"+lastName+"']").val();
   var midNameValue =  $("input[name='"+midName+"']").val();
   var locationofbirthValue =  $("input[name='"+locationofbirth+"']").val();
   var genderValue =  $("select[name='"+gender+"']").val();
   var dateofbirthValue =  $("input[name='"+dateofbirth+"']").val();
   var param = idNumberName+"="+idNumberValue+"&"+idCardTypeName+"="+idCardTypeValue;
       param = param+"&"+firstName+"="+firstNameValue+"&"+lastName+"="+lastNameValue;
       param = param+"&"+midName+"="+midNameValue+"&"+locationofbirth+"="+locationofbirthValue+"&"+gender+"="+genderValue
       param=param+"&"+contactFixedNumber+"="+contactFixedNumberValue+"&"+contactMobileNumber+"="+contactMobileNumberValue;
       param=param+"&"+email+"="+emailValue+"&"+address+"="+addressValue+"&"+verifyingCode+"="+verifyingCodeValue+"&"+dateofbirth+"="+dateofbirthValue;
   var url = path + "/reserveCode.do?method=checkcustomerInput&issubmit=yes";
    getParams(url,param,function(msg)
    {
        var flag = displayError(msg,name);
        if(flag)
        {
           reservesubmit();
        }
        else
        {
          var checkoutmsg =  $('#error_checkout')[0].innerHTML;
          if(checkoutmsg != null && checkoutmsg.length > 0)
          {
             $("input[name='checkout']").val("customer");
             $("form[name='reserveCodeForm']").attr("action",path + "/reserveCode.do?method=checkoutfailure");
             $("form[name='reserveCodeForm']").submit();
          }
        }
    }
    );
}

function reservesubmit()
{
   $("form[name='reserveCodeForm']").submit();
}

function selectNumberNext()
{

 var url = path + "/reserveCode.do?method=checkSelectNumber";
 var obj = $("input[name='reservedMobileNumber']")[0];
 
  ajaxsubMit(obj,url,function(flag)
  {
    if(flag)
    {
       $("form[name='reserveCodeForm']").attr("action",path + "/reserveCode.do?method=selectNumberNext");
       $("form[name='reserveCodeForm']").submit();
    }
  });
}

function reservationMobileNumber()
{
 //window.open (path + "/reserveCode.do?method=reservationMobileNumber", 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')
   $("form[name='reserveCodeForm']").attr("action",path + "/reserveCode.do?method=reservationMobileNumber");
   $("form[name='reserveCodeForm']").submit();
}

function checkMobileNumber(obj)
{

    var url = path + "/reserveCode.do?method=checkSelectNumber";
    ajaxsubMit(obj,url,function(flag){
         if(!flag)
         {
            var checkoutmsg =  $('#error_checkout')[0].innerHTML;
            if(checkoutmsg != null && checkoutmsg.length > 0)
            {
               $("input[name='checkout']").val("mobilenumber");
               $("form[name='reserveCodeForm']").attr("action",path + "/reserveCode.do?method=checkoutfailure");
               $("form[name='reserveCodeForm']").submit();
            }
          }
    });
}

function checkcustomerInput(obj)
{
     var url = path + "/reserveCode.do?method=checkcustomerInput";
     ajaxsubMit(obj,url,function(flag){});
}

function checkcustomerInput2(obj)
{
     var url = path + "/reserveCode.do?method=checkcustomerInput&nv=1";
     ajaxsubMit(obj,url,function(flag){});
}

//add by lixiu 2010-10-15  begin AJAX验证码校验专用JS
function validateVerifyingCode(obj)
{
     var url = path + "/reserveCode.do?method=validateVerifyingCode";
     ajaxsubMit(obj,url,function(flag){});
}
//end by lixiu 2010-10-15

function ajaxsubMit(obj,url,callback1)
{

 var value = obj.value
  var name = obj.name;
   var param=name+"="+value;
   
   getParams(url,param,function(msg)
   {
   		var flag = displayError(msg,name);
   		callback1(flag);
   });
}

function getParams(url,params,callback)
{
   $.post(url
      ,params
      ,function date(msg)
       {
           callback(msg);
       }
   );
}

function displayError(msg,name)
{
   if(msg.length > 2)
   {
     var newMsg = msg.substring(1,msg.length-1);
     var items = newMsg.split("[]],");
     for(var i = 0 ;i < items.length;i++)
     {
       var item = items[i];
       var errors = item.split("=[");
       var key = "#";
       var value = "";
       for(var j = 0;j < errors.length; j++)
       {
          if(j == 0)
          {
             key = key + errors[j].replace(/(^\s*)|(\s*$)/g,'');
          }
          else
          {
             if(errors.length > 2)
             {
                value = value + errors[j];
             }
             else
             {
                value = errors[j];
             }
           }
        }
        if(i == items.length-1)
        {
         value = value.substring(0,value.length-"[]]".length);
        }
        $(key).html(value);
	    
	    //REMOVE BY HKF21815     
		/*
        if(key == "#error_reserveDateofbirth")
        {
		  var obj1 = $("input[name='reserveDateofbirth']").parent();
	 	  obj1.append($(key));
		}*/
        $(key).css("display","");
     }
     return false;
   }
   else
   {
      if(name != null)
      {
         $('#error_'+name).html("");
         $('#error_'+name).css("display","none");
      }
      return true;
   }
}

//add by skf21685  2010-2-27 R002C12L01100 end=======

//add by p00152737 20100306 CC&BM R002C12L01100 for VPN payment relationship begin
//paymentRelation.jsp
function vpnShowPartialPaymentList()
{
     $("#partialPaymentList").show();
	 $("#serviceType").show();
}

function vpnHidePartialPaymentList()
{
    $("#partialPaymentList").hide();
	$("#serviceType").hide();
}

function vpnShowQuotaValue()
{
    $("#quotaValue").attr('disabled', false);
}

function vpnHideQuotaValue()
{
    $("#quotaValue").attr('value','');
    $("#quotaValue").attr('disabled', true);
}

function vpnShowWorkingHours()
{
    $("#workingHours").attr('disabled', false);
}

function vpnHideWorkingHours()
{
    $("#workingHours").attr('disabled', true);
}

function addVpnPaymentRelationRecord()
{
document.getElementById("addServiceError").style.display='none';
document.getElementById("addLimitValueError").style.display='none';
var hasTimeLimit=document.getElementById("VpnModifyPayRelatActionForm").hasTimeLimit.value;

if(hasTimeLimit=='true')
{
document.getElementById("submitError").style.display='none';
}
document.getElementById("submitRecordError").style.display='none';

var paymentTypes=document.getElementById("VpnModifyPayRelatActionForm").paymentType;
var paymentTypeValue=0;
for(var i=0;i<paymentTypes.length;i++)
{
  if(paymentTypes[i].checked)
   {
  paymentTypeValue=paymentTypes[i].value;
   }
}
if(paymentTypeValue==1)
{
var quotaTypes=document.getElementById("VpnModifyPayRelatActionForm").quotaType;
var quotaTypeValue=0;
for(var i=0;i<quotaTypes.length;i++)
{
  if(quotaTypes[i].checked)
   {
  quotaTypeValue=quotaTypes[i].value;
   }
}

var quotaValue=0;
if(quotaTypeValue == 1)
{
quotaValue=document.getElementById("VpnModifyPayRelatActionForm").quotaValue.value;
if(quotaValue==0)
{
document.getElementById("addLimitValueError").style.display='';
return;
}
}

var onlyForWorkings=document.getElementById("VpnModifyPayRelatActionForm").onlyForWorking;
var onlyForWorkingValue=0;
var workHours=null;
if(hasTimeLimit=='false')
{
onlyForWorkingValue=onlyForWorkings.value;
}
else
{
for(var i=0;i<onlyForWorkings.length;i++)
{
  if(onlyForWorkings[i].checked)
   {
  onlyForWorkingValue=onlyForWorkings[i].value;
   }
}

if(onlyForWorkingValue==1)
{
workHours=document.getElementById("VpnModifyPayRelatActionForm").workingHours.value;
}
	if(workHours == null)
	{
		workHours='All Day';
	}

}
var serviceType=document.getElementById("VpnModifyPayRelatActionForm").serviceType.value;

var selectService=document.getElementById("VpnModifyPayRelatActionForm").selectService;
var selectServiceValue=null;
if(selectService !=null)
{
if(selectService.length==null)
{
selectServiceValue=selectService.value;
if(selectServiceValue==serviceType)
{
document.getElementById("addServiceError").style.display='';
return;
}
}
else
{
for(var i=0;i<selectService.length;i++)
{
if(selectService[i].value==serviceType)
{
document.getElementById("addServiceError").style.display='';
return;
}
}
}
}
AddSignRow(serviceType,quotaTypeValue,quotaValue,onlyForWorkingValue,workHours);

}
}

//add table row
function findObj(theObj, theDoc){  
var p, i, foundObj;
if(!theDoc) theDoc = document;  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) 
{   
 theDoc = parent.frames[theObj.substring(p+1)].document;   
 theObj = theObj.substring(0,p); 
  }  
if(!(foundObj = theDoc[theObj]) && theDoc.all) 
   foundObj = theDoc.all[theObj]; 
  for (i=0; !foundObj && i < theDoc.forms.length; i++)  
          foundObj = theDoc.forms[i][theObj];  
          for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
              foundObj = findObj(theObj,theDoc.layers[i].document); 
               if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj); 
                  return foundObj;
}

function AddSignRow(serviceType,quotaTypeValue,quotaValue,onlyForWorkingValue,workHours){  
 var txtTRLastIndex = findObj("txtTRLastIndex",document);
 var rowID = parseInt(txtTRLastIndex.value);
 var signFrame = findObj("SignFrame",document);
 
 var newTR = signFrame.insertRow(signFrame.rows.length);
 newTR.id = "SignItem" + rowID;
 
 
 var newNameTD=newTR.insertCell(0);
 
var serviceTypeIndex=document.getElementById("VpnModifyPayRelatActionForm").serviceType.selectedIndex;
 var serviceText=document.getElementById("VpnModifyPayRelatActionForm").serviceType.options[serviceTypeIndex].text
 newNameTD.innerHTML ="<input type='hidden' name='addedRecords' value='"+serviceType+":"+quotaTypeValue+":"+quotaValue+":"+onlyForWorkingValue+":"+workHours+"' />"+ serviceText;
 
 
 var newEmailTD=newTR.insertCell(1);
 
 var quotatype=null;
 if(quotaTypeValue==0)
 {
 quotatype=document.getElementById("VpnModifyPayRelatActionForm").NotUpperLimit.value
 }
 else
 {
  quotatype=document.getElementById("VpnModifyPayRelatActionForm").UpperLimit.value
 }
 newEmailTD.innerHTML ="<input type='hidden' name='selectService' value='"+serviceType+"' />"+quotatype;
 
 
 var newTelTD=newTR.insertCell(2);
 
 newTelTD.innerHTML = quotaValue;
 
var hasTimeLimit=document.getElementById("VpnModifyPayRelatActionForm").hasTimeLimit.value;
 
if(hasTimeLimit == 'true')
{
 var onlyForWorking=null;
 if(onlyForWorkingValue==0)
 {
 onlyForWorking=document.getElementById("VpnModifyPayRelatActionForm").No.value
 }
 else
 {
  onlyForWorking=document.getElementById("VpnModifyPayRelatActionForm").Yes.value
 }
 var newMobileTD=newTR.insertCell(3);
 
 newMobileTD.innerHTML = onlyForWorking;
 
 
 var newCompanyTD=newTR.insertCell(4);
 
var workHourText='';
if(onlyForWorkingValue==1)
 {
 var workHourIndex=document.getElementById("VpnModifyPayRelatActionForm").workingHours.selectedIndex;
 workHourText=document.getElementById("VpnModifyPayRelatActionForm").workingHours.options[workHourIndex].text
 newCompanyTD.innerHTML = workHourText;
 } 
 else 
 {
 	newCompanyTD.innerHTML = workHours;
 }

 var newDeleteTD=newTR.insertCell(5);
 newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='javascript:;' onclick=\"DeleteSignRow('SignItem" + rowID + "')\">Delete</a></div>";
 txtTRLastIndex.value = (rowID + 1).toString() ;
}
else
{
 var newDeleteTD=newTR.insertCell(3);
 newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='javascript:;' onclick=\"DeleteSignRow('SignItem" + rowID + "')\">Delete</a></div>";
 txtTRLastIndex.value = (rowID + 1).toString() ;
}
}
 
function DeleteSignRow(rowid){
 var signFrame = findObj("SignFrame",document);
 var signItem = findObj(rowid,document);
 
 var rowIndex = signItem.rowIndex;
 
 signFrame.deleteRow(rowIndex);
} 

//submit vpn ModifyPaymentRelation
function vpnModifyPaymentrationSubmit()
{
var paymentTypes=document.getElementById("VpnModifyPayRelatActionForm").paymentType;
var paymentTypeValue=0;
for(var i=0;i<paymentTypes.length;i++)
{
  if(paymentTypes[i].checked)
   {
  paymentTypeValue=paymentTypes[i].value;
   }
}

var quotaTypes=document.getElementById("VpnModifyPayRelatActionForm").quotaType;
var quotaTypeValue=0;
for(var i=0;i<quotaTypes.length;i++)
{
  if(quotaTypes[i].checked)
   {
  quotaTypeValue=quotaTypes[i].value;
   }
}

if(0==paymentTypeValue )
{
if(1==quotaTypeValue)
{
var quotaValue=0;
quotaValue=document.getElementById("VpnModifyPayRelatActionForm").quotaValue.value;
if(0==quotaValue.length)
{
document.getElementById("addLimitValueError").style.display='';
return false;
}
}
var onlyForWorkings=document.getElementById("VpnModifyPayRelatActionForm").onlyForWorking;
var onlyForWorkingValue=0;
var workHours=null;
var hasTimeLimit=document.getElementById("VpnModifyPayRelatActionForm").hasTimeLimit.value;
if(hasTimeLimit == 'true')
{
for(var i=0;i<onlyForWorkings.length;i++)
{
  if(onlyForWorkings[i].checked)
   {
  onlyForWorkingValue=onlyForWorkings[i].value;
   }
}

if(onlyForWorkingValue==1)
{
workHours=document.getElementById("VpnModifyPayRelatActionForm").workingHours.value;
if(null ==workHours)
{
document.getElementById("submitError").style.display='';
return false;
}
}
}
var serviceType=document.getElementById("VpnModifyPayRelatActionForm").serviceType.value;
if(null == serviceType)
{
document.getElementById("submitError").style.display='';
return false;
}

}
else
{
var addedRecords=document.getElementById("VpnModifyPayRelatActionForm").addedRecords;

if(null ==addedRecords || 'undefined' == addedRecords)
{
document.getElementById("submitRecordError").style.display='';
return false;
}
}
}
//Added end

// add by KF22290 lrf strat
function toBreakWord(obj, intLen){ 
//var obj=document.getElementById(el); 
var strContent=obj.html();
var strTemp=""; 
while(strContent.length>intLen){ 
strTemp+=strContent.substr(0,intLen)+" "; 
strContent=strContent.substr(intLen,strContent.length); 
} 

strTemp+= strContent; 
obj.html(strTemp); 
} 
//显示select,选择限额
 function displaySelect(obj){
   var td = obj.parentNode ;  
   var tr=td.parentNode;
   var payValueQuota=getText(td.getElementsByTagName('LABEL')[0]);
   //定位select的option
   if(trim(payValueQuota)=='Yes')
   	{
   		td.getElementsByTagName('SELECT')[0].options[0].selected= true ;
	}
	else
	{
		td.getElementsByTagName('SELECT')[0].options[1].selected= true ;
	}
	td.getElementsByTagName('SELECT')[0].style.display='';
	td.getElementsByTagName('A')[0].style.display='none';
	td.getElementsByTagName('LABEL')[0].style.display='none';
   }
//显示submit按钮,
function addSubmit(obj)
{
   var td = obj.parentNode ; 
   var payValueQuota=getText(td.getElementsByTagName('LABEL')[0]);
   var newpayValueQuota= td.getElementsByTagName('SELECT')[0].value;
 	newpayValueQuota=newpayValueQuota=='-1'?'Yes':'No';
	   if( payValueQuota==newpayValueQuota){
	     td.getElementsByTagName('INPUT')[0].style.display='none';
	   }
	   else
	   {
	    td.getElementsByTagName('INPUT')[0].style.display='';
	   }
}
//提交修改限额信息
 function doPayValueQuotasubmit(obj){
 	var td = obj.parentNode ;  
    var tr=td.parentNode;
    //注意下面取值,如果表格数据变动,需要随着变动.!!!
    var msisdn=getText(tr.cells[1]);
    var newpayValueQuota=td.getElementsByTagName('SELECT')[0].value;
    var dataStr="child_msidn="+msisdn+"&payQuota="+newpayValueQuota;
    //请求修改bundle用户的附额
    $.ajax({
    	type: "POST",
    	url: path+"/bundleInfo/STBundleInfoAction.do?method=modifyBundlePayQuota",
    	data: dataStr, 
   		cache: false,
    	success: function(data){
    		td.getElementsByTagName('INPUT')[0].disabled=false;
	        if(data==0){
		    	setText(td.getElementsByTagName('LABEL')[0],newpayValueQuota=='-1'?'Yes':'No');
		    	td.getElementsByTagName('LABEL')[0].style.display='';
		    	td.getElementsByTagName('A')[0].style.display='';
		    	td.getElementsByTagName('SELECT')[0].style.display='none'
		    	td.getElementsByTagName('INPUT')[0].style.display='none';
	        }else{
	        	alert("modify failue! "+data);
	        }
      } 
      }
      );
     td.getElementsByTagName('INPUT')[0].disabled=true;
 }
 //取值 支持多浏器  
function getText(obj){
	  if($.browser.msie){
		return obj.innerText;
    }else
    {
   	    return obj.textContent;
    }
    
}
 //设置值 支持多浏器  
function setText(obj,value){
	  if($.browser.msie){
		return obj.innerText=value;
    }else
    {
   	    return obj.textContent=value;
    }
}
//add by  KF22290 lrf end  2010-06-08